home *** CD-ROM | disk | FTP | other *** search
- Path: news.otol.fi!rhea!tkes
- From: tkes@rhea.otol.fi (Timo Sakari)
- Newsgroups: comp.lang.c,comp.lang.c++
- Subject: New printf - like function, is it possible?
- Date: 1 Feb 1996 12:18:50 GMT
- Organization: Oulu Institute of Technology, Finland
- Message-ID: <4eqb3a$2r5@pan.otol.fi>
- NNTP-Posting-Host: rhea-atm.otol.fi
- X-Newsreader: TIN [version 1.2 PL0]
-
-
- Hi!
-
- Do you C-gurus have any solutions to this problem?
-
- I am programming under MS Windows 3.1 (this is NOT an OS spesific
- question!)and I would like to create
- some kind of modified print function, which syntax should be something
- like normal printf; because in Windows printf can't be used, everything
- printed to screen has to come through message boxes etc, and before
- displaying anything, the string to displayed has to be formed. I have
- created my own printing function, which wants parameters string and winID
- to know where to put that string, something like this:
-
- sprintf(printStr, "some sfuff, variables %d, %f, etc", var1, var2);
- PrintToWin(DEBUG_WIN_1, printStr);
-
- However, I want to write a "better" printing function, where string to be
- formed doesn't need to be formatted first, it can be displayed and formed
- at the same time in the same syntax like printf, something like these:
-
- PrintToWin(DEBUG_WIN_1, "some stuff etc, %d, %f, %s, var1, var2, str1);
- PrintToWin(OTHER_WIN, "anything that printf accepts");
-
- So I want to print almost anything with this function without having
- to write many functions to different argument types/number of arguments.
- This should be possible in C++ (is it?), but is it possible in C ?
- Can this be achieved by using void pointers and macros etc., or should
- I give up and don't waste my time on this?
-
- Any help would be greatly appreciated. Thanks.
-
-
-
- --
- Timo Sakari phone: (981) 5306 070
- Haapanatie 2 D 408 email: tkes@rhea.otol.fi
- 90150 OULU WWW: http://www.otol.fi/~tkes/
- FINLAND
-